package com.dstz.org.rest.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dstz.base.api.query.QueryFilter;
import com.dstz.base.api.query.QueryOP;
import com.dstz.base.core.util.StringUtil;
import com.dstz.base.db.model.page.PageResult;
import com.dstz.base.rest.BaseController;
import com.dstz.org.core.manager.UserCreditRecordManager;
import com.dstz.org.core.model.Group;
import com.dstz.org.core.model.UserCreditRecord;
import com.dstz.sys.util.ContextUtil;
import com.github.pagehelper.Page;

/**
 * <pre>
 * 描述：用户表 控制器类
 * </pre>
 */
@RestController
@RequestMapping("/org/userCreditRecord")
public class UserCreditRecordController extends BaseController<UserCreditRecord> {
    @Resource
    UserCreditRecordManager userCreditRecordManager;
    

    @Override
    protected String getModelDesc() {
        return "用户积分变化记录";
    }
    
    @RequestMapping("listJson")
    public PageResult listJson(HttpServletRequest request, HttpServletResponse response) throws Exception {
    	String userId = request.getParameter("userId");
        QueryFilter queryFilter = getQueryFilter(request);
        if(StringUtil.isNotEmpty(userId))
        	queryFilter.addFilter("user_id_", userId, QueryOP.EQUAL);
        Page<UserCreditRecord> userCreditRecordList = (Page<UserCreditRecord>) userCreditRecordManager.query(queryFilter);
        return new PageResult(userCreditRecordList);
    }
}
